/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.manchester.biology.eqhei.persistence;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author mlwyatt
 */
@Embeddable
public class EvaluationPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "UTM")
    private String utm;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "userName")
    private String userName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "evaluationTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date evaluationTime;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "sectionName")
    private String sectionName;

    public EvaluationPK() {
    }

    public EvaluationPK(String utm, String userName, Date evaluationTime, String sectionName) {
        this.utm = utm;
        this.userName = userName;
        this.evaluationTime = evaluationTime;
        this.sectionName = sectionName;
    }

    public String getUtm() {
        return utm;
    }

    public void setUtm(String utm) {
        this.utm = utm;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getEvaluationTime() {
        return evaluationTime;
    }

    public void setEvaluationTime(Date evaluationTime) {
        this.evaluationTime = evaluationTime;
    }

    public String getSectionName() {
        return sectionName;
    }

    public void setSectionName(String sectionName) {
        this.sectionName = sectionName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (utm != null ? utm.hashCode() : 0);
        hash += (userName != null ? userName.hashCode() : 0);
        hash += (evaluationTime != null ? evaluationTime.hashCode() : 0);
        hash += (sectionName != null ? sectionName.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EvaluationPK)) {
            return false;
        }
        EvaluationPK other = (EvaluationPK) object;
        if ((this.utm == null && other.utm != null) || (this.utm != null && !this.utm.equals(other.utm))) {
            return false;
        }
        if ((this.userName == null && other.userName != null) || (this.userName != null && !this.userName.equals(other.userName))) {
            return false;
        }
        if ((this.evaluationTime == null && other.evaluationTime != null) || (this.evaluationTime != null && !this.evaluationTime.equals(other.evaluationTime))) {
            return false;
        }
        if ((this.sectionName == null && other.sectionName != null) || (this.sectionName != null && !this.sectionName.equals(other.sectionName))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.manchester.biology.eqhei.business.EvaluationPK[ utm=" + utm + ", userName=" + userName + ", evaluationTime=" + evaluationTime + ", sectionName=" + sectionName + " ]";
    }
    
}
